<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"><title>在Ubuntu20上安装CUDA+cuDNN+Miniconda环境(其它系统同理) | 飞の博客</title><meta name="author" content="Fei"><meta name="copyright" content="Fei"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="ffffff"><meta name="description" content="在Ubuntu20上安装CUDA+cuDNN+Miniconda环境">
<meta property="og:type" content="article">
<meta property="og:title" content="在Ubuntu20上安装CUDA+cuDNN+Miniconda环境(其它系统同理)">
<meta property="og:url" content="https://tengfei2233.gitee.io/2023/11/10/%E5%9C%A8Ubuntu20%E4%B8%8A%E5%AE%89%E8%A3%85CUDA-cuDNN-Miniconda%E7%8E%AF%E5%A2%83(%E5%85%B6%E5%AE%83%E7%B3%BB%E7%BB%9F%E5%90%8C%E7%90%86)/index.html">
<meta property="og:site_name" content="飞の博客">
<meta property="og:description" content="在Ubuntu20上安装CUDA+cuDNN+Miniconda环境">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://blog-1306275892.cos.ap-shanghai.myqcloud.com/hexo/blogs/2023-11-10/ai.jpg">
<meta property="article:published_time" content="2023-11-10T07:27:51.000Z">
<meta property="article:modified_time" content="2023-11-10T07:27:51.000Z">
<meta property="article:author" content="Fei">
<meta property="article:tag" content="AI">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://blog-1306275892.cos.ap-shanghai.myqcloud.com/hexo/blogs/2023-11-10/ai.jpg"><link rel="shortcut icon" href="https://blog-1306275892.cos.ap-shanghai.myqcloud.com/hexo/common/icon.png"><link rel="canonical" href="https://tengfei2233.gitee.io/2023/11/10/%E5%9C%A8Ubuntu20%E4%B8%8A%E5%AE%89%E8%A3%85CUDA-cuDNN-Miniconda%E7%8E%AF%E5%A2%83(%E5%85%B6%E5%AE%83%E7%B3%BB%E7%BB%9F%E5%90%8C%E7%90%86)/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//hm.baidu.com"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><meta name="msvalidate.01" content="2ADFA30867CBC6E090E3C5B244DC311D"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.3.0/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.staticfile.org/fancyapps-ui/4.0.31/fancybox.min.css" media="print" onload="this.media='all'"><script>var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?07a1f58fb95d3d4a97c2ae0a181c9964";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"/search.xml","preload":false,"languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":200},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.staticfile.org/flickr-justified-gallery/2.1.2/fjGallery.min.js',
      css: 'https://cdn.staticfile.org/flickr-justified-gallery/2.1.2/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: true,
  islazyload: false,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: true,
  }
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '在Ubuntu20上安装CUDA+cuDNN+Miniconda环境(其它系统同理)',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2023-11-10 15:27:51'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
    win.getCSS = (url,id = false) => new Promise((resolve, reject) => {
      const link = document.createElement('link')
      link.rel = 'stylesheet'
      link.href = url
      if (id) link.id = id
      link.onerror = reject
      link.onload = link.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        link.onload = link.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(link)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', 'ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 6.3.0"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><script>const preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',()=> { preloader.endLoading() })

if (false) {
  document.addEventListener('pjax:send', () => { preloader.initLoading() })
  document.addEventListener('pjax:complete', () => { preloader.endLoading() })
}</script><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://blog-1306275892.cos.ap-shanghai.myqcloud.com/hexo/common/fei.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">24</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">28</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">16</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友情链接</span></a></div><div class="menus_item"><a class="site-page" target="_blank" rel="noopener" href="https://github.com/tengfei2233"><i class="fa-fw fas fa-heart"></i><span> 关于我</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://blog-1306275892.cos.ap-shanghai.myqcloud.com/hexo/blogs/2023-11-10/ai.jpg')"><nav id="nav"><span id="blog-info"><a href="/" title="飞の博客"><span class="site-name">飞の博客</span></a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search" href="javascript:void(0);"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友情链接</span></a></div><div class="menus_item"><a class="site-page" target="_blank" rel="noopener" href="https://github.com/tengfei2233"><i class="fa-fw fas fa-heart"></i><span> 关于我</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">在Ubuntu20上安装CUDA+cuDNN+Miniconda环境(其它系统同理)</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-11-10T07:27:51.000Z" title="发表于 2023-11-10 15:27:51">2023-11-10</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-11-10T07:27:51.000Z" title="更新于 2023-11-10 15:27:51">2023-11-10</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/AI/">AI</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">3.4k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>12分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="在Ubuntu20上安装CUDA+cuDNN+Miniconda环境(其它系统同理)"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h2 id="在Ubuntu20上安装CUDA-cuDNN-Miniconda环境"><a href="#在Ubuntu20上安装CUDA-cuDNN-Miniconda环境" class="headerlink" title="在Ubuntu20上安装CUDA+cuDNN+Miniconda环境"></a>在Ubuntu20上安装CUDA+cuDNN+Miniconda环境</h2><h3 id="基本介绍"><a href="#基本介绍" class="headerlink" title="基本介绍"></a>基本介绍</h3><h4 id="什么是CUDA"><a href="#什么是CUDA" class="headerlink" title="什么是CUDA"></a>什么是CUDA</h4><blockquote>
<p>CUDA（Compute Unified Device Architecture）是由NVIDIA开发的并行计算平台和编程模型。它允许开发者使用NVIDIA的GPU进行通用目的的并行计算。CUDA提供了一套编程接口和工具，使开发者能够利用GPU的并行计算能力来加速各种类型的计算任务。</p>
<p>CUDA的主要组成部分包括：</p>
<ol>
<li>CUDA编程语言扩展：CUDA提供了一种扩展C&#x2F;C++语言的方式，使开发者能够在代码中使用CUDA的并行计算功能。通过在代码中插入CUDA的特定语法和指令，开发者可以编写并行计算任务，并将其在GPU上执行。</li>
<li>CUDA运行时库：CUDA运行时库是一组函数和工具，用于管理GPU设备、内存分配、并行计算任务的启动和同步等操作。开发者可以使用CUDA运行时库来管理GPU资源，并在程序中调用相关函数来执行并行计算任务。</li>
<li>CUDA工具包：CUDA工具包提供了一系列工具，用于开发、调试和优化CUDA程序。其中包括编译器、调试器、性能分析器等工具，帮助开发者更好地理解和优化他们的CUDA代码。</li>
</ol>
<p>CUDA的设计目标是提供一种高性能、灵活和易用的并行计算平台，使开发者能够充分利用GPU的并行计算能力。它已经成为广泛应用于科学计算、机器学习、深度学习等领域的重要工具和技术。</p>
</blockquote>
<h4 id="什么是cuDNN"><a href="#什么是cuDNN" class="headerlink" title="什么是cuDNN"></a>什么是cuDNN</h4><blockquote>
<p>cuDNN（CUDA Deep Neural Network library）是NVIDIA开发的针对深度神经网络的加速库。它是基于CUDA平台的深度学习加速库，旨在提供高性能的深度神经网络计算，加速深度学习模型的训练和推理过程。</p>
<p>cuDNN提供了一系列优化算法和函数，用于执行深度神经网络中的常见操作，如卷积、池化、归一化等。这些算法和函数经过高度优化，针对NVIDIA GPU的架构进行了深度优化，以提供最佳的性能和效率。</p>
<p>使用cuDNN库，开发者可以在深度学习框架（如TensorFlow、PyTorch等）的基础上，利用GPU的并行计算能力加速深度神经网络的训练和推理过程。cuDNN库提供了简单易用的API接口，使开发者能够方便地集成和使用它的功能。</p>
<p>cuDNN广泛应用于深度学习领域，特别是在训练和推理大规模深度神经网络时，它可以显著提高计算性能，加快模型的训练速度和推理速度。同时，cuDNN还支持多种数据类型和精度，包括浮点数和半精度浮点数，以满足不同应用场景的需求。</p>
</blockquote>
<h4 id="什么是Anaconda"><a href="#什么是Anaconda" class="headerlink" title="什么是Anaconda"></a>什么是Anaconda</h4><blockquote>
<p>Anaconda是一个开源的Python和R编程语言的发行版本，旨在简化软件包管理和环境管理。它提供了一个集成的开发环境，包括Python解释器、常用的科学计算库、数据分析工具和其他相关软件包。</p>
<p>Anaconda的主要特点和功能包括：</p>
<ol>
<li>软件包管理：Anaconda提供了一个强大的包管理系统，可以方便地安装、更新和删除各种Python和R软件包。它拥有一个广泛的软件包仓库（Anaconda Repository），其中包含了大量常用的科学计算和数据分析工具。</li>
<li>环境管理：Anaconda允许用户创建和管理多个独立的Python环境。每个环境可以拥有不同的软件包版本和依赖关系，使用户能够轻松地切换和管理不同项目或应用程序的开发环境。</li>
<li>集成开发环境：Anaconda附带了一个名为Anaconda Navigator的图形用户界面（GUI），用于管理和启动各种工具和应用程序，如Jupyter Notebook、Spyder等。这些工具提供了丰富的功能，支持交互式编程、数据可视化、调试和实验等。</li>
<li>跨平台支持：Anaconda可在多个操作系统上运行，包括Windows、macOS和Linux。这使得开发者能够在不同的平台上保持一致的开发环境和代码执行结果。</li>
</ol>
<p>除了以上功能，Anaconda还提供了一些其他工具和服务，如Anaconda Cloud（用于共享和发布软件包）、Anaconda Enterprise（用于团队和企业级的开发和部署）等。</p>
<p>总的来说，Anaconda是一个功能强大的数据科学平台，提供了丰富的工具和库，使得数据科学家、研究人员和开发者能够更轻松地进行Python和R编程、数据分析和机器学习等任务。</p>
</blockquote>
<h4 id="CUDA与cuDNN的区别"><a href="#CUDA与cuDNN的区别" class="headerlink" title="CUDA与cuDNN的区别"></a>CUDA与cuDNN的区别</h4><blockquote>
<p>CUDA（Compute Unified Device Architecture）和cuDNN（CUDA Deep Neural Network library）是两个相关但不同的概念。</p>
<p>CUDA是由NVIDIA提供的并行计算平台和编程模型，它允许开发者使用标准的C&#x2F;C++编程语言在NVIDIA GPU上进行并行计算。CUDA提供了一组编程接口和工具，使开发者能够利用GPU的并行计算能力加速各种计算任务，包括深度学习模型的训练和推理。</p>
<p>cuDNN是NVIDIA开发的深度神经网络加速库，专门针对深度学习模型的计算进行了优化。cuDNN建立在CUDA的基础上，提供了一系列高度优化的算法和函数，用于执行深度神经网络中的常见操作，如卷积、池化、归一化等。cuDNN的目标是通过利用GPU的并行计算能力，提供高性能和效率，加速深度学习模型的训练和推理过程。</p>
<p>因此，cuDNN是一个建立在CUDA之上的库，它利用CUDA提供的并行计算能力来加速深度学习计算。在使用深度学习框架（如TensorFlow、PyTorch等）进行开发时，通常会同时使用CUDA和cuDNN。CUDA提供了底层的GPU计算能力，cuDNN则提供了针对深度学习模型的高度优化计算操作。这样的组合可以提供更高的性能和效率，加速深度学习任务的执行。</p>
</blockquote>
<h3 id="安装Cuda"><a href="#安装Cuda" class="headerlink" title="安装Cuda"></a>安装Cuda</h3><h4 id="前置"><a href="#前置" class="headerlink" title="前置"></a>前置</h4><ul>
<li>在Ubuntu20上安装Nvidia最新的显卡驱动，具体怎么安装驱动，这里跳过；（因为我使用的是WSL下的Linux，驱动只要宿主机安装了即可）</li>
<li>在命令行执行nvidia-smi，出现以下内容说明你的驱动安装成功，记住右上角的CUDA Version；（以下以我的电脑为例，这里是12.2）</li>
</ul>
<figure class="highlight sh"><table><tr><td class="code"><pre><span class="line">Sun Aug 20 22:23:30 2023</span><br><span class="line">+---------------------------------------------------------------------------------------+</span><br><span class="line">| NVIDIA-SMI 535.54.04              Driver Version: 536.23       CUDA Version: 12.2     |</span><br><span class="line">|-----------------------------------------+----------------------+----------------------+</span><br><span class="line">| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |</span><br><span class="line">| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |</span><br><span class="line">|                                         |                      |               MIG M. |</span><br><span class="line">|=========================================+======================+======================|</span><br><span class="line">|   0  NVIDIA GeForce RTX 2050        On  | 00000000:01:00.0 Off |                  N/A |</span><br><span class="line">| N/A   42C    P8               3W /  60W |     12MiB /  4096MiB |      0%      Default |</span><br><span class="line">|                                         |                      |                  N/A |</span><br><span class="line">+-----------------------------------------+----------------------+----------------------+</span><br><span class="line"></span><br><span class="line">+---------------------------------------------------------------------------------------+</span><br><span class="line">| Processes:                                                                            |</span><br><span class="line">|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |</span><br><span class="line">|        ID   ID                                                             Usage      |</span><br><span class="line">|=======================================================================================|</span><br><span class="line">|    0   N/A  N/A        22      G   /Xwayland                                 N/A      |</span><br><span class="line">+---------------------------------------------------------------------------------------+</span><br></pre></td></tr></table></figure>

<h4 id="下载cuda"><a href="#下载cuda" class="headerlink" title="下载cuda"></a>下载cuda</h4><ul>
<li>进入<a target="_blank" rel="noopener" href="https://developer.nvidia.com/cuda-toolkit-archive">Cuda官网下载地址</a>，根据你的nvidia-smi下CUDA Version选择Cuda版本，注意：不是选一模一样的，选最接近，且小于的；比如我的电脑CUDA Version是12.2的，那么我选择12.1的；</li>
</ul>
<figure class="highlight sh"><table><tr><td class="code"><pre><span class="line"><span class="comment"># 比如我的下载地址是</span></span><br><span class="line">wget https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda_12.1.0_530.30.02_linux.run</span><br></pre></td></tr></table></figure>

<ul>
<li>安装相关依赖包</li>
</ul>
<figure class="highlight sh"><table><tr><td class="code"><pre><span class="line">sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev</span><br></pre></td></tr></table></figure>

<ul>
<li>安装Cuda</li>
</ul>
<figure class="highlight sh"><table><tr><td class="code"><pre><span class="line">sudo sh cuda_12.1.0_530.30.02_linux.run</span><br><span class="line"></span><br><span class="line"><span class="comment"># 1. 在第一个弹出的界面输入accept回车</span></span><br><span class="line"><span class="comment"># 2. 在第二个界面上下键按enter选择你要安装的部分，取消driver部分，一定要选择cuda toolkit部分</span></span><br><span class="line"><span class="comment"># 3. 移动到最下方install回车安装</span></span><br></pre></td></tr></table></figure>

<ul>
<li>安装完成后配置环境变量</li>
</ul>
<figure class="highlight sh"><table><tr><td class="code"><pre><span class="line"><span class="comment"># 打开.bashrc，光标指到下方</span></span><br><span class="line">vim ~/.bashrc</span><br><span class="line"></span><br><span class="line"><span class="comment"># 填入以下内容</span></span><br><span class="line"><span class="built_in">export</span> PATH=<span class="variable">$PATH</span>:/usr/local/cuda/bin</span><br><span class="line"><span class="built_in">export</span> LD_LIBRARY_PATH=<span class="variable">$LD_LIBRARY_PATH</span>:/usr/local/cuda/lib64</span><br><span class="line"><span class="built_in">export</span> LIBRARY_PATH=<span class="variable">$LIBRARY_PATH</span>:/usr/local/cuda/lib64</span><br><span class="line"></span><br><span class="line"><span class="comment"># 保存退出，刷新.bashrc</span></span><br><span class="line"><span class="built_in">source</span> ~/.bashrc</span><br><span class="line"></span><br><span class="line"><span class="comment"># 执行nvcc -V，出现版本信息，说明cuda安装成功</span></span><br></pre></td></tr></table></figure>

<h3 id="安装cuDNN"><a href="#安装cuDNN" class="headerlink" title="安装cuDNN"></a>安装cuDNN</h3><h4 id="下载cudnn"><a href="#下载cudnn" class="headerlink" title="下载cudnn"></a>下载cudnn</h4><ul>
<li>进入<a target="_blank" rel="noopener" href="https://developer.nvidia.com/rdp/cudnn-download">cudnn下载地址</a>，第一次进入需要注册一个账号才能下载；</li>
<li>选择与cuda版本对应的（这里与cuda版本对应是指cuda驱动版本，比如上文中的12.1）</li>
<li>比如我的是选择这个：<a target="_blank" rel="noopener" href="https://developer.nvidia.com/downloads/compute/cudnn/secure/8.9.1/local_installers/12.x/cudnn-linux-x86_64-8.9.1.23_cuda12-archive.tar.xz/">Local Installer for Linux x86_64 (Tar)</a>，注意选择Linux版本的压缩包</li>
<li>解压文件</li>
</ul>
<figure class="highlight sh"><table><tr><td class="code"><pre><span class="line"><span class="comment"># 解压文件</span></span><br><span class="line">sudo tar -xvf cudnn-linux-x86_64-8.9.1.23_cuda12-archive.tar.xz</span><br><span class="line"></span><br><span class="line"><span class="comment">#进入文件目录</span></span><br><span class="line"><span class="built_in">cd</span> cudnn-linux-x86_64-8.9.1.23_cuda12-archive</span><br><span class="line"></span><br><span class="line"><span class="comment"># 执行以下命令，将文件拷贝到cuda目录</span></span><br><span class="line"><span class="built_in">cp</span> include/* /usr/local/cuda/include</span><br><span class="line"></span><br><span class="line"><span class="built_in">cp</span> lib/* /usr/local/cuda/lib64 或者 <span class="built_in">cp</span> lib64/* /usr/local/cuda/lib64</span><br></pre></td></tr></table></figure>

<ul>
<li>验证安装cudnn安装是否成功</li>
</ul>
<figure class="highlight sh"><table><tr><td class="code"><pre><span class="line"><span class="comment"># 输入以下命令</span></span><br><span class="line"><span class="built_in">cat</span> /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2</span><br><span class="line"></span><br><span class="line"><span class="comment"># 出现以下内容说明安装成功</span></span><br><span class="line"></span><br><span class="line"><span class="comment">#define CUDNN_MAJOR 8</span></span><br><span class="line"><span class="comment">#define CUDNN_MINOR 9</span></span><br><span class="line"><span class="comment">#define CUDNN_PATCHLEVEL 1</span></span><br><span class="line">--</span><br><span class="line"><span class="comment">#define CUDNN_VERSION (CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)</span></span><br><span class="line"></span><br><span class="line">/* cannot use constexpr here since this is a C-only file */</span><br></pre></td></tr></table></figure>

<h3 id="安装Miniconda3"><a href="#安装Miniconda3" class="headerlink" title="安装Miniconda3"></a>安装Miniconda3</h3><h4 id="下载miniconda"><a href="#下载miniconda" class="headerlink" title="下载miniconda"></a>下载miniconda</h4><ul>
<li>在<a target="_blank" rel="noopener" href="https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/">Index of &#x2F;anaconda&#x2F;miniconda&#x2F; | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror</a>下选择你要下载的版本;（选择sh结尾文件）</li>
<li>下载到用户目录&#x2F;home&#x2F;username&#x2F;，这样可以防止权限问题</li>
<li>比如我选择：<a target="_blank" rel="noopener" href="https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py310_23.5.1-0-Linux-x86_64.sh" title="Miniconda3-py310_23.5.1-0-Linux-x86_64.sh">Miniconda3-py310_23.5.1-0-Linux-x86_64.sh</a></li>
</ul>
<h4 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h4><figure class="highlight sh"><table><tr><td class="code"><pre><span class="line"><span class="comment"># 运行（注意不要加sudo）</span></span><br><span class="line">bash Miniconda3-py310_23.5.1-0-Linux-x86_64.sh</span><br><span class="line"></span><br><span class="line"><span class="comment"># 按照提示选择同意许可，中途几次回车</span></span><br><span class="line"><span class="comment"># 安装完成后</span></span><br><span class="line"><span class="comment"># 设置环境变量</span></span><br><span class="line">vim ~/.bashrc</span><br><span class="line"></span><br><span class="line"><span class="comment"># 在末尾添加</span></span><br><span class="line"><span class="built_in">export</span> PATH=<span class="variable">$PATH</span>:/你的miniconda安装路径/bin</span><br><span class="line"><span class="comment"># 保存后输入</span></span><br><span class="line"><span class="built_in">source</span> ~/.bashrc</span><br><span class="line"></span><br><span class="line">conda init bash</span><br></pre></td></tr></table></figure>

<h4 id="更改conda镜像源"><a href="#更改conda镜像源" class="headerlink" title="更改conda镜像源"></a>更改conda镜像源</h4><figure class="highlight sh"><table><tr><td class="code"><pre><span class="line"></span><br><span class="line"><span class="comment"># 更改安装镜像源，在.condarc下添加以下内容</span></span><br><span class="line"><span class="comment"># 以添加清华镜像源为例</span></span><br><span class="line">channels:</span><br><span class="line">  - defaults</span><br><span class="line">show_channel_urls: <span class="literal">true</span></span><br><span class="line">default_channels:</span><br><span class="line">  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main</span><br><span class="line">  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r</span><br><span class="line">  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2</span><br><span class="line">custom_channels:</span><br><span class="line">  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud</span><br><span class="line">  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud</span><br><span class="line">  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud</span><br><span class="line">  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud</span><br><span class="line">  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud</span><br><span class="line">  pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud</span><br><span class="line">  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud</span><br><span class="line">  deepmodeling: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/</span><br><span class="line"></span><br><span class="line"><span class="comment"># 保存退出，执行</span></span><br><span class="line">conda init bash</span><br></pre></td></tr></table></figure>

<h4 id="conda常见命令"><a href="#conda常见命令" class="headerlink" title="conda常见命令"></a>conda常见命令</h4><figure class="highlight sh"><table><tr><td class="code"><pre><span class="line"></span><br><span class="line"><span class="comment"># 查看conda配置信息</span></span><br><span class="line">conda info</span><br><span class="line"></span><br><span class="line"><span class="comment"># 查看当前环境列表 * 表示当前激活的环境</span></span><br><span class="line">conda <span class="built_in">env</span> list</span><br><span class="line"></span><br><span class="line"><span class="comment"># 激活环境</span></span><br><span class="line">conda activate --name myenvname</span><br><span class="line"></span><br><span class="line"><span class="comment"># 查看当前环境下包列表</span></span><br><span class="line">conda list</span><br><span class="line"></span><br><span class="line"><span class="comment"># 创建环境</span></span><br><span class="line">conda create --name myenvname</span><br><span class="line"></span><br><span class="line"><span class="comment"># 创建指定python版本的环境</span></span><br><span class="line">conda create -n myenvname python=x.x.x</span><br><span class="line"></span><br><span class="line"><span class="comment"># 删除环境</span></span><br><span class="line">conda <span class="built_in">env</span> remove --name myenvname</span><br><span class="line"></span><br><span class="line"><span class="comment"># 删除环境后清理缓存</span></span><br><span class="line">conda clean --all</span><br><span class="line"></span><br><span class="line"><span class="comment"># 安装新版本指定包</span></span><br><span class="line">conda install package_name</span><br><span class="line"></span><br><span class="line"><span class="comment"># 安装指定版本包</span></span><br><span class="line">conda install package_name=x.x</span><br><span class="line"></span><br><span class="line"><span class="comment"># 更新包</span></span><br><span class="line">conda update packate_name</span><br><span class="line"></span><br><span class="line"><span class="comment"># 卸载包</span></span><br><span class="line">conda remove package_name</span><br><span class="line"></span><br><span class="line"><span class="comment"># 导出环境</span></span><br><span class="line">conda <span class="built_in">env</span> <span class="built_in">export</span> &gt; environment.yml</span><br><span class="line"></span><br><span class="line"><span class="comment"># 导入环境</span></span><br><span class="line">conda <span class="built_in">env</span> create -f environment.yml</span><br><span class="line"></span><br><span class="line"><span class="comment"># 克隆环境</span></span><br><span class="line">conda create --name newnev --<span class="built_in">clone</span> oldenv</span><br></pre></td></tr></table></figure>


<ul>
<li>首先用conda创建python10的环境（为什么用pyhton10，因为stable-diffusion-webui官方推荐）</li>
</ul>
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">conda create -n sd_webui python=3.10.6</span><br></pre></td></tr></table></figure>

<ul>
<li>进入<a target="_blank" rel="noopener" href="https://pytorch.org/get-started/previous-versions/">Pytorch官网</a>选择合适的pytorch版本，根据自己cuda版本选择</li>
<li>使用nvidia-smi命令查看自己gpu的cuda版本，右上角CUDA Version便是cuda版本，选择比这个低的</li>
<li>安装pytorch</li>
</ul>
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">我的话是选择这个版本的</span></span><br><span class="line">conda install pytorch==1.13.0 torchvision==0.14.0 torchaudio==0.13.0 pytorch-cuda=11.7 -c pytorch -c nvidia</span><br></pre></td></tr></table></figure>

<h3 id="下载stable-diffusion-webui"><a href="#下载stable-diffusion-webui" class="headerlink" title="下载stable-diffusion-webui"></a>下载stable-diffusion-webui</h3><ul>
<li>使用git拉取项目</li>
</ul>
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">网络慢的自己想办法了（一般这个开github的代理）</span></span><br><span class="line">git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git</span><br></pre></td></tr></table></figure>

<h3 id="运行安装"><a href="#运行安装" class="headerlink" title="运行安装"></a>运行安装</h3><ul>
<li>克隆环境</li>
</ul>
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">为什么要克隆环境呢，是怕要是安装出问题了，pytorch不用重新安装</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">上面我们已经创建了一个sd_webui的pytorch环境，我们将sd_webui克隆一个为pytorch基础环境</span></span><br><span class="line">conda create -n pytorch --clone sd_webui</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">查看环境列表</span></span><br><span class="line">conda env list</span><br></pre></td></tr></table></figure>

<ul>
<li>下载模型（这一步推荐先做）</li>
</ul>
<figure class="highlight text"><table><tr><td class="code"><pre><span class="line"># 1. 进入这个网站下载一个模型：https://civitai.com/models</span><br><span class="line"># 2. 将模型放到stable-diffusion-webui/models/Stable-diffusion目录下</span><br><span class="line"># 3. 模型可以按你的习惯进行重命名，好区分</span><br></pre></td></tr></table></figure>

<ul>
<li>进入stable-diffusion-webui根目录</li>
</ul>
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">执行，下载依赖（指定阿里云镜像源下载，要不然容易下载失败）</span></span><br><span class="line">pip install -r requirements.txt ---index-url=https://mirrors.aliyun.com/pypi/simple/</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">如果下载过程中有的依赖出错了，就用pip install 包名 手动下载（或者更换其它镜像源下载）</span></span><br></pre></td></tr></table></figure>

<ul>
<li>在stable-diffusion-webui下执行</li>
</ul>
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">克隆一份（防止改坏）</span></span><br><span class="line">cp webui.sh my-webui.sh</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">编辑my-webui.sh</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">将第一行的变量改为1</span></span><br><span class="line">use_venv=0</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">在首行添加以下内容</span></span><br><span class="line">export COMMANDLINE_ARGS=&quot;--listen --enable-insecure-extension-access&quot;</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">保存退出</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">开启代理，执行my-weiui.sh （第一次运行要开代理，一定要开启代理，非常重要）（至于代理怎么开，可以自己先去学习下如何开启，配置clash）</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">运行日志中出现网页访问地址说明运行成功了</span></span><br></pre></td></tr></table></figure>

<h3 id="界面汉化"><a href="#界面汉化" class="headerlink" title="界面汉化"></a>界面汉化</h3><ul>
<li>初始化的界面是全英文的，如果你不介意，可以跳过；</li>
<li>下载这个json文件：<a target="_blank" rel="noopener" href="https://github.com/dtlnor/stable-diffusion-webui-localization-zh_CN/blob/main/localizations/zh_CN.json">https://github.com/dtlnor/stable-diffusion-webui-localization-zh_CN/blob/main/localizations/zh_CN.json</a>；</li>
<li>将这个文件放到stable-diffusion-webui&#x2F;localizations目录下；</li>
<li>重启项目，在界面上找到Setting-&gt;<em>Enable Bilingual Localization，选择zh_CN，保存，重新载入界面，汉化就完成了；</em></li>
<li>接下来就是AI炼丹了。</li>
</ul>
<h3 id="常见问题"><a href="#常见问题" class="headerlink" title="常见问题"></a>常见问题</h3><ul>
<li>Cannot locate TCMalloc (improves CPU memory usage)</li>
</ul>
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">执行以下命令</span></span><br><span class="line">sudo apt-get install libgoogle-perftools4 libtcmalloc-minimal4 -y</span><br></pre></td></tr></table></figure>

</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="https://tengfei2233.gitee.io">Fei</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://tengfei2233.gitee.io/2023/11/10/%E5%9C%A8Ubuntu20%E4%B8%8A%E5%AE%89%E8%A3%85CUDA-cuDNN-Miniconda%E7%8E%AF%E5%A2%83(%E5%85%B6%E5%AE%83%E7%B3%BB%E7%BB%9F%E5%90%8C%E7%90%86)/">https://tengfei2233.gitee.io/2023/11/10/%E5%9C%A8Ubuntu20%E4%B8%8A%E5%AE%89%E8%A3%85CUDA-cuDNN-Miniconda%E7%8E%AF%E5%A2%83(%E5%85%B6%E5%AE%83%E7%B3%BB%E7%BB%9F%E5%90%8C%E7%90%86)/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://tengfei2233.gitee.io" target="_blank">飞の博客</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/AI/">AI</a></div><div class="post_share"><div class="social-share" data-image="https://blog-1306275892.cos.ap-shanghai.myqcloud.com/hexo/blogs/2023-11-10/ai.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.staticfile.org/butterfly-extsrc/1.1.3/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.staticfile.org/butterfly-extsrc/1.1.3/sharejs/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button"><i class="fas fa-qrcode"></i> 打赏</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="https://blog-1306275892.cos.ap-shanghai.myqcloud.com/hexo/common/wechat.png" target="_blank"><img class="post-qr-code-img" src="https://blog-1306275892.cos.ap-shanghai.myqcloud.com/hexo/common/wechat.png" alt="微信"/></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="https://blog-1306275892.cos.ap-shanghai.myqcloud.com/hexo/common/alipay.png" target="_blank"><img class="post-qr-code-img" src="https://blog-1306275892.cos.ap-shanghai.myqcloud.com/hexo/common/alipay.png" alt="支付宝"/></a><div class="post-qr-code-desc">支付宝</div></li></ul></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/2023/8/27/Docker-Compose%E5%AD%A6%E4%B9%A0/" title="Docker Compose学习"><img class="cover" src="https://blog-1306275892.cos.ap-shanghai.myqcloud.com/hexo/blogs/2023-6-26/docker.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">Docker Compose学习</div></div></a></div><div class="next-post pull-right"><a href="/2023/11/10/%E5%9C%A8conda%E7%8E%AF%E5%A2%83%E4%B8%8B%E8%BF%90%E8%A1%8Cstable-diffusion-webui-AI%E7%BB%98%E5%9B%BE/" title="在conda环境下运行stable-diffusion-webui AI绘图"><img class="cover" src="https://blog-1306275892.cos.ap-shanghai.myqcloud.com/hexo/blogs/2023-11-10/ai.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">在conda环境下运行stable-diffusion-webui AI绘图</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><div><a href="/2023/11/10/%E5%9C%A8conda%E7%8E%AF%E5%A2%83%E4%B8%8B%E8%BF%90%E8%A1%8Cstable-diffusion-webui-AI%E7%BB%98%E5%9B%BE/" title="在conda环境下运行stable-diffusion-webui AI绘图"><img class="cover" src="https://blog-1306275892.cos.ap-shanghai.myqcloud.com/hexo/blogs/2023-11-10/ai.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="fas fa-history fa-fw"></i> 2023-11-10</div><div class="title">在conda环境下运行stable-diffusion-webui AI绘图</div></div></a></div></div></div><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div class="vcomment" id="vcomment"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://blog-1306275892.cos.ap-shanghai.myqcloud.com/hexo/common/fei.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">Fei</div><div class="author-info__description">当你想起来了，那就记录一点吧</div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">24</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">28</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">16</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/tengfei2233"><i class="fab fa-github"></i><span>关注我</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/tengfei2233" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="https://gitee.com/tengfei2233" target="_blank" title="Gitee"><i class="fab fa-git"></i></a><a class="social-icon" href="/youfeige@outlook.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">当你迷茫的时候，那就静下心想想吧！</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%9C%A8Ubuntu20%E4%B8%8A%E5%AE%89%E8%A3%85CUDA-cuDNN-Miniconda%E7%8E%AF%E5%A2%83"><span class="toc-number">1.</span> <span class="toc-text">在Ubuntu20上安装CUDA+cuDNN+Miniconda环境</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E4%BB%8B%E7%BB%8D"><span class="toc-number">1.1.</span> <span class="toc-text">基本介绍</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BB%80%E4%B9%88%E6%98%AFCUDA"><span class="toc-number">1.1.1.</span> <span class="toc-text">什么是CUDA</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BB%80%E4%B9%88%E6%98%AFcuDNN"><span class="toc-number">1.1.2.</span> <span class="toc-text">什么是cuDNN</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BB%80%E4%B9%88%E6%98%AFAnaconda"><span class="toc-number">1.1.3.</span> <span class="toc-text">什么是Anaconda</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#CUDA%E4%B8%8EcuDNN%E7%9A%84%E5%8C%BA%E5%88%AB"><span class="toc-number">1.1.4.</span> <span class="toc-text">CUDA与cuDNN的区别</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%89%E8%A3%85Cuda"><span class="toc-number">1.2.</span> <span class="toc-text">安装Cuda</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%89%8D%E7%BD%AE"><span class="toc-number">1.2.1.</span> <span class="toc-text">前置</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%B8%8B%E8%BD%BDcuda"><span class="toc-number">1.2.2.</span> <span class="toc-text">下载cuda</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%89%E8%A3%85cuDNN"><span class="toc-number">1.3.</span> <span class="toc-text">安装cuDNN</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%B8%8B%E8%BD%BDcudnn"><span class="toc-number">1.3.1.</span> <span class="toc-text">下载cudnn</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%89%E8%A3%85Miniconda3"><span class="toc-number">1.4.</span> <span class="toc-text">安装Miniconda3</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%B8%8B%E8%BD%BDminiconda"><span class="toc-number">1.4.1.</span> <span class="toc-text">下载miniconda</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%AE%89%E8%A3%85"><span class="toc-number">1.4.2.</span> <span class="toc-text">安装</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%9B%B4%E6%94%B9conda%E9%95%9C%E5%83%8F%E6%BA%90"><span class="toc-number">1.4.3.</span> <span class="toc-text">更改conda镜像源</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#conda%E5%B8%B8%E8%A7%81%E5%91%BD%E4%BB%A4"><span class="toc-number">1.4.4.</span> <span class="toc-text">conda常见命令</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%B8%8B%E8%BD%BDstable-diffusion-webui"><span class="toc-number">1.5.</span> <span class="toc-text">下载stable-diffusion-webui</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%BF%90%E8%A1%8C%E5%AE%89%E8%A3%85"><span class="toc-number">1.6.</span> <span class="toc-text">运行安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%95%8C%E9%9D%A2%E6%B1%89%E5%8C%96"><span class="toc-number">1.7.</span> <span class="toc-text">界面汉化</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98"><span class="toc-number">1.8.</span> <span class="toc-text">常见问题</span></a></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2023/11/21/netty%E7%9A%84%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8%EF%BC%8C%E5%9F%BA%E6%9C%AC%E5%8E%9F%E7%90%86%E5%88%86%E6%9E%90%EF%BC%8C%E7%9B%B8%E5%85%B3%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3-%E6%9B%B4%E6%96%B0%E4%B8%AD/" title="netty的基本使用，基本原理分析，相关问题解(更新中...)"><img src="https://blog-1306275892.cos.ap-shanghai.myqcloud.com/hexo/blogs/2023-11-10/netty-ai.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="netty的基本使用，基本原理分析，相关问题解(更新中...)"/></a><div class="content"><a class="title" href="/2023/11/21/netty%E7%9A%84%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8%EF%BC%8C%E5%9F%BA%E6%9C%AC%E5%8E%9F%E7%90%86%E5%88%86%E6%9E%90%EF%BC%8C%E7%9B%B8%E5%85%B3%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3-%E6%9B%B4%E6%96%B0%E4%B8%AD/" title="netty的基本使用，基本原理分析，相关问题解(更新中...)">netty的基本使用，基本原理分析，相关问题解(更新中...)</a><time datetime="2023-11-21T09:27:51.000Z" title="发表于 2023-11-21 17:27:51">2023-11-21</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/11/10/%E5%9C%A8conda%E7%8E%AF%E5%A2%83%E4%B8%8B%E8%BF%90%E8%A1%8Cstable-diffusion-webui-AI%E7%BB%98%E5%9B%BE/" title="在conda环境下运行stable-diffusion-webui AI绘图"><img src="https://blog-1306275892.cos.ap-shanghai.myqcloud.com/hexo/blogs/2023-11-10/ai.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="在conda环境下运行stable-diffusion-webui AI绘图"/></a><div class="content"><a class="title" href="/2023/11/10/%E5%9C%A8conda%E7%8E%AF%E5%A2%83%E4%B8%8B%E8%BF%90%E8%A1%8Cstable-diffusion-webui-AI%E7%BB%98%E5%9B%BE/" title="在conda环境下运行stable-diffusion-webui AI绘图">在conda环境下运行stable-diffusion-webui AI绘图</a><time datetime="2023-11-10T07:30:51.000Z" title="发表于 2023-11-10 15:30:51">2023-11-10</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/11/10/%E5%9C%A8Ubuntu20%E4%B8%8A%E5%AE%89%E8%A3%85CUDA-cuDNN-Miniconda%E7%8E%AF%E5%A2%83(%E5%85%B6%E5%AE%83%E7%B3%BB%E7%BB%9F%E5%90%8C%E7%90%86)/" title="在Ubuntu20上安装CUDA+cuDNN+Miniconda环境(其它系统同理)"><img src="https://blog-1306275892.cos.ap-shanghai.myqcloud.com/hexo/blogs/2023-11-10/ai.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="在Ubuntu20上安装CUDA+cuDNN+Miniconda环境(其它系统同理)"/></a><div class="content"><a class="title" href="/2023/11/10/%E5%9C%A8Ubuntu20%E4%B8%8A%E5%AE%89%E8%A3%85CUDA-cuDNN-Miniconda%E7%8E%AF%E5%A2%83(%E5%85%B6%E5%AE%83%E7%B3%BB%E7%BB%9F%E5%90%8C%E7%90%86)/" title="在Ubuntu20上安装CUDA+cuDNN+Miniconda环境(其它系统同理)">在Ubuntu20上安装CUDA+cuDNN+Miniconda环境(其它系统同理)</a><time datetime="2023-11-10T07:27:51.000Z" title="发表于 2023-11-10 15:27:51">2023-11-10</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/8/27/Docker-Compose%E5%AD%A6%E4%B9%A0/" title="Docker Compose学习"><img src="https://blog-1306275892.cos.ap-shanghai.myqcloud.com/hexo/blogs/2023-6-26/docker.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Docker Compose学习"/></a><div class="content"><a class="title" href="/2023/8/27/Docker-Compose%E5%AD%A6%E4%B9%A0/" title="Docker Compose学习">Docker Compose学习</a><time datetime="2023-08-27T15:34:50.000Z" title="发表于 2023-08-27 23:34:50">2023-08-27</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/8/27/Dockerfile%E5%AD%A6%E4%B9%A0/" title="Dockerfile学习"><img src="https://blog-1306275892.cos.ap-shanghai.myqcloud.com/hexo/blogs/2023-6-26/docker.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Dockerfile学习"/></a><div class="content"><a class="title" href="/2023/8/27/Dockerfile%E5%AD%A6%E4%B9%A0/" title="Dockerfile学习">Dockerfile学习</a><time datetime="2023-08-27T15:34:37.000Z" title="发表于 2023-08-27 23:34:37">2023-08-27</time></div></div></div></div></div></div></main><footer id="footer" style="background-image: url('https://blog-1306275892.cos.ap-shanghai.myqcloud.com/hexo/blogs/2023-11-10/ai.jpg')"><div id="footer-wrap"><div class="copyright">&copy;2022 - 2024 By Fei</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text">欢迎进入<a href="tengfei2233.gitee.io/">飞の博客</a>!</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">繁</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="https://cdn.staticfile.org/hexo-theme-butterfly/4.7.0/js/utils.min.js"></script><script src="https://cdn.staticfile.org/hexo-theme-butterfly/4.7.0/js/main.min.js"></script><script src="https://cdn.staticfile.org/hexo-theme-butterfly/4.7.0/js/tw_cn.min.js"></script><script src="https://cdn.staticfile.org/fancyapps-ui/4.0.31/fancybox.umd.min.js"></script><script src="https://cdn.staticfile.org/instant.page/5.1.1/instantpage.min.js" type="module"></script><script>function panguFn () {
  if (typeof pangu === 'object') pangu.autoSpacingPage()
  else {
    getScript('https://cdn.staticfile.org/pangu/4.0.7/pangu.min.js')
      .then(() => {
        pangu.autoSpacingPage()
      })
  }
}

function panguInit () {
  if (false){
    GLOBAL_CONFIG_SITE.isPost && panguFn()
  } else {
    panguFn()
  }
}

document.addEventListener('DOMContentLoaded', panguInit)</script><div class="js-pjax"><script>function loadValine () {
  function initValine () {
    const valine = new Valine(Object.assign({
      el: '#vcomment',
      appId: '0kbeJfFlvhvkYfqMqwwVCx1a-gzGzoHsz',
      appKey: 'rziWUw1MTHMW7d9eeCQzu9HV',
      avatar: 'monsterid',
      serverURLs: '',
      emojiMaps: "",
      path: window.location.pathname,
      visitor: false
    }, null))
  }

  if (typeof Valine === 'function') initValine() 
  else getScript('https://cdn.staticfile.org/valine/1.5.1/Valine.min.js').then(initValine)
}

if ('Valine' === 'Valine' || !true) {
  if (true) btf.loadComment(document.getElementById('vcomment'),loadValine)
  else setTimeout(loadValine, 0)
} else {
  function loadOtherComment () {
    loadValine()
  }
}</script></div><script defer="defer" id="ribbon" src="https://cdn.staticfile.org/butterfly-extsrc/1.1.3/canvas-ribbon.min.js" size="150" alpha="0.6" zIndex="-1" mobile="false" data-click="true"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div></div></div><div id="search-mask"></div><script src="https://cdn.staticfile.org/hexo-theme-butterfly/4.7.0/js/search/local-search.min.js"></script></div></body></html>